package com.zdp.degisn.pipe_filter.selector.impl;

import com.zdp.degisn.pipe_filter.filter.Filter;
import com.zdp.degisn.pipe_filter.selector.Selector;

import java.util.HashSet;
import java.util.Set;

/**
 * @author zhengdp
 * @Description
 * @Date 2022/9/6 23:14
 * @Created by zhengdp
 */
public class SickSelectorImpl implements Selector {

    private SickSelectorImpl(){}

    // 内部类实现单例
    private static class SickSelectorImplSingle{
        private static final SickSelectorImpl instance = new SickSelectorImpl();
    }

    private final Set<String> filterSets;
    {
        filterSets = new HashSet<>();
        filterSets.add("StudentFilter");
        filterSets.add("TeacherFilter");
    }

    public static SickSelectorImpl instance(){
        return SickSelectorImplSingle.instance;
    }

    @Override
    public boolean match(Filter filter) {
        return filterSets.contains(filter.getFilterName());
    }
}
